{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-header">
        <form action="{:url('user/customer/index')}" class="layui-form" method="get">
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <input type="text" name="cname" value="{:input('cname')}" autocomplete="off" placeholder="请输入客户名称" class="layui-input"/>
                </div>
                <div class="layui-input-inline">
                    <select name="type">
                        <option value="">{:user_config_totitle('type','customer')}</option>
                        {foreach name=":parse_attr($type.options)" key="i" item="j"}
                        <option value="{$i}" {if condition="input('?type') and (input('type') eq $i)"} selected="selected"{/if}>{$j}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="intention">
                        <option value="">{:user_config_totitle('intention','customer')}</option>
                        {foreach name=":parse_attr($intention.options)" key="i" item="j"}
                        <option value="{$i}" {if condition="input('?intention') and (input('intention') eq $i)"} selected="selected"{/if}>{$j}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="come_from">
                        <option value="">{:user_config_totitle('come_from','customer')}</option>
                        {foreach name=":parse_attr($come_from.options)" key="i" item="j"}
                        <option value="{$i}" {if condition="input('?come_from') and (input('come_from') eq $i)"} selected="selected"{/if}>{$j}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="status">
                        <option value="">{:user_config_totitle('status','customer')}</option>
                        {foreach name=":parse_attr($status.options)" key="i" item="j"}
                        <option value="{$i}" {if condition="input('?status') and (input('status') eq $i)"} selected="selected"{/if}>{$j}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="layui-input-inline">
                    <button class="layui-btn layui-btn-primary ajax-search"><i class="fa fa-search"></i></button>
                </div>
            </div>
        </form>
    </div>
    <div class="layui-card-body">
        <div class="layui-btn-group">
            <a href="{:url('user/customer/add')}" class="layui-btn"><i class="fa fa-plus-circle"></i> 新增客户</a>
            <!--a href="#" class="layui-btn layui-btn-danger ajax-batch"><i class="fa fa-trash-o"></i> 批量转移</a-->
            <a href="{:url('user/customer/index')}" class="layui-btn layui-btn-normal"><i class="fa fa-user"></i> 全部客户</a>
            <a href="{:url('user/customer/index',['screen' => 'star'])}" class="layui-btn layui-btn-primary"><i class="fa fa-star"></i> 重要客户</a>
            <a href="{:url('user/customer/index',['screen' => 'today_add'])}" class="layui-btn layui-btn-primary"><i class="fa fa-star"></i> 今日新增</a>
            <a href="{:url('user/customer/index',['screen' => 'today_track'])}" class="layui-btn layui-btn-primary"><i class="fa fa-star"></i> 今日跟进过</a>
            <a href="{:url('user/customer/index',['screen' => '30day_notrack'])}" class="layui-btn layui-btn-primary"><i class="fa fa-star"></i> 30天未跟进</a>
            <a href="{:url('user/customer/index',['screen' => 'notrack'])}" class="layui-btn layui-btn-primary"><i class="fa fa-star"></i> 从未跟进</a>
        </div>
		<table class="layui-table layui-form" lay-filter="customer">
			<thead>
				<tr>
                                        <th>{:user_config_totitle('intention','customer')}</th>
					<th>客户名称</th>
					<th>手机号码</th>
					<th lay-data="{field:'province',sort: true}">区域</th>
					<th lay-data="{field:'address'}">地址</th>
					<th lay-data="{field:'type',sort: true}">{:user_config_totitle('type','customer')}</th>
                                        <th lay-data="{field:'come_from',sort: true}">{:user_config_totitle('come_from','customer')}</th>
					<th lay-data="{field:'create_time',sort: true}">创建时间</th>
                                        <th lay-data="{field:'update_time',sort: true}">更新时间</th>
					<th lay-data="{field:'status',sort: true}">{:user_config_totitle('status','customer')}</th>
                                        <th lay-data="{field:'uid',sort: true}">操作人</th>
					<th lay-data="{field:'setting',sort: true}">操作</th>
				</tr>
			</thead>
			<tbody>
				{foreach name="list" item="v" empty="$empty"}
				<tr>
					<td>{:user_config_toval('intention',$v['intention'],'customer')}</td>
                                        <td>{$v.cname}</td>
					<td>{$v.mobile}</td>
                                        <td>{$v.province}/{$v.city}/{$v.area}</td>
                                        <td>{$v.address}</td>
                                        <td>{:user_config_toval('type',$v['type'],'customer')}</td>
                                        <td>{:user_config_toval('come_from',$v['come_from'],'customer')}</td>
					<td>{:time_trans($v['create_time'])}</td>
                                        <td>{:time_trans($v['update_time'])}</td>
                                        <td>{:user_config_toval('status',$v['status'],'customer')}</td>
                                        <td>{:get_user_realname($v['uid'])}</td>
					<td>
                                            <a href="{:url('user/customer/show', ['id' => $v.id])}" class="layui-btn layui-btn-xs layui-btn-normal"><i class="fa fa-desktop"></i> 查看</a>
                                            <a href="{:url('user/customer/edit', ['id' => $v.id])}" class="layui-btn layui-btn-xs layui-btn-normal"><i class="fa fa-edit"></i> 编辑</a>
                                            <a href="{:url('user/customer/del', ['id' => $v.id])}" class="layui-btn layui-btn-xs layui-btn-danger ajax-delete"><i class="fa fa-trash-o"></i> 删除</a>
					</td>
				</tr>
				{/foreach}
			</tbody>
		</table>
		<div class="page">{$list->render()}</div>
	</div>
</div>
{/block}